<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <div id="app">
        姓名：<input type="text" v-model="name"> <br>
        年龄：<input type="text" v-model="age"> <br>
        职业：<input type="text" v-model="profession"> <br>
        <p> 输出：{{info}} </p>
        <button v-on:click="clear">清空</button>
    </div>
    <script>
        const app = new MVVM({
            el: '#app',
            data: {
                name: '',
                age: '',
                profession: ''
            },
            methods: {
                clear() {
                    this.name = '';
                    this.age = '';
                    this.profession = '';
                }
            },
            computed: {
                info() {
                    return `我叫${this.name}，今年${this.age}，是一名${this.profession}`;
                }
            }
        })
    </script>
</body>
</html>